﻿using System;

namespace Entities
{
    [Serializable]
    public class tblProductSpecial
    {
        private int product_id;
        private int category_id;
        private int customer_group_id;
        private int priority;
        private int price;
        private DateTime date_start;
        private DateTime date_end;

        public tblProductSpecial() {}

        public tblProductSpecial(int product_id, int category_id, int customer_group_id, int priority, int price, DateTime date_start, DateTime date_end)
        {
            this.product_id = product_id;
            this.category_id = category_id;
            this.customer_group_id = customer_group_id;
            this.priority = priority;
            this.price = price;
            this.date_start = date_start;
            this.date_end = date_end;
        }

        public int productID
        {
            get { return this.product_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mă sản phẩm không được để trống!");
                this.product_id = value;
            }
        }

        public int categoryID
        {
            get { return this.category_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mă nhóm sản phẩm không được để trống!");
                this.category_id = value;
            }
        }

        public int customerGroupID
        {
            get { return this.customer_group_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mă nhóm khách hàng không được để trống!");
                this.customer_group_id = value;
            }
        }

        public int Priority
        {
            get { return this.priority; }
            set
            {
                this.priority = value;
            }
        }

        public int Price
        {
            get { return this.price; }
            set
            {
                this.price = value;
            }
        }

        public DateTime dateStart
        {
            get { return this.date_start; }
            set
            {
                this.date_start = value;
            }
        }

        public DateTime dateEnd
        {
            get { return this.date_end; }
            set
            {
                this.date_end = value;
            }
        }

        public override string ToString()
        {
	        return this.product_id+"; "+this.category_id+"; "+this.customer_group_id+"; "+this.priority+"; "+this.price+"; "+this.date_start+"; "+this.date_end+"; ";
	    }
	    public override bool Equals(Object obj)
	    {
            tblProductSpecial me = (tblProductSpecial)obj;
            bool ret = this.productID.Equals(me.productID);
	        return ret;
	    }
	    public override int GetHashCode()
	    {
            return this.productID.GetHashCode();
	    }

    }
}
